/*
 * Led_Bsp.h
 *
 *  Created on: Dec 3, 2020
 *      Author: Administrator
 */

#ifndef LED_BSP_H_
#define LED_BSP_H_

#ifndef		LED_H
#define		LED_H


#include	"stm32h7xx_hal.h"
#include	"stdint.h"
#include	"main.h"
//#include	"userFuns.h"


#define		SPADGER_PI_V10


#define		LED_MAX_NO			7
#define		LED_MIN_NO			1

#define		LED_SYS_RUN_NO		1
#define		LED_USER1			2


#define		LED_ON			GPIO_PIN_RESET
#define		LED_OFF			GPIO_PIN_SET

#ifdef		SPADGER_PI_V05
#define		LED1_PORT		GPIOE
#define		LED1_PIN		GPIO_PIN_3
#endif


#ifdef		SPADGER_PI_V10
#define		LED1_PORT		GPIOE
#define		LED1_PIN		GPIO_PIN_14
#endif

#define		LED2_PORT		GPIOA
#define		LED2_PIN		GPIO_PIN_8

#define		LED3_PORT		GPIOC
#define		LED3_PIN		GPIO_PIN_9

#define		LED4_PORT		GPIOC
#define		LED4_PIN		GPIO_PIN_12

#define		LED5_PORT		GPIOD
#define		LED5_PIN		GPIO_PIN_2

#define		LED6_PORT		GPIOC
#define		LED6_PIN		GPIO_PIN_6

#define		LED7_PORT		GPIOC
#define		LED7_PIN		GPIO_PIN_7


typedef struct gpio_pin{
	GPIO_TypeDef	*port;
	uint16_t		pin;
	uint16_t		reserved;
}gpio_pin_t;



void led_test(void);
void led_init(void);
void led_toggle(uint16_t ledNo);
void led_on(uint16_t ledNo);
void led_off(uint16_t ledNo);
void led_offall(void);

void 	led_process(void);

#endif


#endif /* LED_BSP_H_ */
